import { createApp } from 'vue'

import ElementPlus from 'element-plus'
import locale from 'element-plus/es/locale/lang/zh-cn'
import 'element-plus/dist/index.css'

import router from './router'
import store from './store'
import XtAdmin from './components/xt-admin'

import App from './App.vue'
import Func from './utils/Func.js'

import * as ElementPlusIconsVue from '@element-plus/icons-vue'

import { initRouter } from '@/router/routerUtil'
initRouter();

import registerEvent from '@/events/event'
registerEvent()

const app = createApp(App)
app.use(ElementPlus, {locale})
app.use(router)
app.use(store)

app.use(XtAdmin)

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}

app.config.globalProperties.Func = Func

app.mount('#app')
